<template>
  <div class="messageShow" v-show="isShow">
    <span>{{message}}</span>
  </div>
</template>

<script>
  export default {
    name: "toast",
    data(){
      return{
        message:'',
        isShow: false
      }
    },
    methods: {
      show(message='hahah',timeDu = 1000){
        this.message = message
        this.isShow = true
        console.log("111"+this.message);
        setTimeout(()=>{
          this.message = ''
          this.isShow = false
        },timeDu)
      }
    }
  }
</script>

<style scoped>
  .messageShow{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    z-index: 999;

    color: #fff;
    background-color: black;
    height: 20px;

  }

</style>